package org.example.server.search.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.example.api.search.controller.SearchControllerFeign;
import org.example.api.search.controller.request.GoodsSearchRequest;
import org.example.api.search.controller.response.GoodsDocSummeryResponse;
import org.example.frw.api.base.response.PageResponse;
import org.example.server.search.mapstruct.GoodsDocConverter;
import org.example.server.search.service.SearchService;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class GoodsSearchController implements SearchControllerFeign {
  @Resource
  private SearchService searchService;
  @Resource
  private GoodsDocConverter converter;

  @Override
  public PageResponse<GoodsDocSummeryResponse> searchGoods(GoodsSearchRequest request) {
    return converter.toPageGoodsDocSummeryResponse(searchService.searchGoods(request));
  }
}
